package com.oriental.manage.controller.reserve.business;

import com.oriental.manage.core.paging.Pagination;
import com.oriental.manage.core.response.ResponseDTO;
import com.oriental.manage.service.reserve.BankTransDetailService;
import com.oriental.reserve.model.business.DayTransDetailDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Author: Yang xp
 * Date: 2017/3/6
 * Time: 18:53
 * Desc：
 */
@Controller
@Slf4j
@RequestMapping("/reserve/day/trans")
public class ReserveDayTransDetailController {

    @Autowired
    private BankTransDetailService bankTransDetailService;

    @RequestMapping("/init")
    public String init(){
        return "reserve/trans/searchDayTransDetail";
    }

    @RequestMapping("/search")
    @ResponseBody
    public ResponseDTO<Pagination<DayTransDetailDto>> search(@RequestBody Pagination<DayTransDetailDto> pagination){
        ResponseDTO<Pagination<DayTransDetailDto>> responseDTO = new ResponseDTO<>();
        try {
            log.info("日结查询请求信息:{}",pagination);
            bankTransDetailService.queryDayTransDetail(pagination.getQueryBean(),responseDTO,pagination);
        } catch (Exception e){
            log.error("日结信息查询:",e);
            responseDTO.setSuccess(false);
            responseDTO.setMsg("日结信息查询失败");
        }
        return responseDTO;
    }

}
